<%@page contentType="content-type: application/x-javascript" %>
var CERRAR = {

	inicio : function() {
		document.getElementById('contenedor').getElementsByTagName('button')[0].onclick = function() {
			if (window.parent.document.getElementById('PPDGFrame') != null) {
				var freim = window.parent.document.getElementById('PPDGFrame');
				freim.parentNode.removeChild(freim);
			} else {
				if (window.opener.document != null) {
					var freim = window.opener.document.getElementById('PPDGFrame');
					freim.parentNode.removeChild(freim);
				}
				window.close();
			}
		};
	}
	
}




function handleEmbeddedFlow() {
	if (top && top.opener && top.opener.top) {
		top.opener.top.myEmbeddedPaymentFlow.paymentCanceled();
		window.close();
	} else if (top.myEmbeddedPaymentFlow) {
		top.myEmbeddedPaymentFlow.paymentCanceled();
	} /*else {
		alert('Por favor, cierra la ventana y recarga para continuar');
	}*/
}




window.onload = function() {
	CERRAR.inicio();
	setTimeout(handleEmbeddedFlow,200);
}